# -*- coding: utf-8 -*-
# filename: basic.py
import urllib
import time
import json


class WeChatApi():
    def get_token(self, appid, secret):
        postUrl = ("https://api.weixin.qq.com/cgi-bin/token?grant_type="
                   "client_credential&appid=%s&secret=%s" % (appid, secret))
        urlResp = urllib.urlopen(postUrl)
        urlResp = json.loads(urlResp.read())

        # accessToken = urlResp['access_token']
        accessToken = 'FAKE'# urlResp['access_token']
        leftTime = 'FAKE'# urlResp['expires_in']
        return accessToken

    def get_jsticket(self, token):
        postUrl = ("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=%s&type=jsapi" % (token))
        urlResp = urllib.urlopen(postUrl)
        urlResp = json.loads(urlResp.read())

        ticket = 'FAKE'# urlResp['ticket']
        leftTime = 'FAKE' # urlResp['expires_in']
        return ticket